/**
 * Created by ss on 16/4/11.
 */
var $ = require("jquery");
var receiveTpl = require("../../../tpl/receiveTpl.tpl");
var tplUtil = require("../../util/templateUtil.js");
var util = require("../../util/util.js");
module.exports = {
    tpl: receiveTpl,
    data: [],
    init: function (jDom,data) {
        this.data = data;
        jDom.html(this.render(this.data));
    },
    render: function (list){
        var cleanData = list.map(function (item) {
            try{
                item.latestInfo = JSON.parse(item.latestInfo);
            }catch(e){
                item.latestInfo = item.latestInfo;
            }
            item.corpItem = util.getCorpItem(item.com);
            return item;
        });
        return tplUtil.template(this.tpl, {
            list: cleanData
        });
    }
};